﻿using UnityEngine;
using System.Collections;

public class Global: MonoBehaviour {

    // Use this for initialization
    
    SubModuleMgr subModuleMgr;

	void Start () {

        NotifySystem.Instance.RefreshNotify = showNotify;

        FileDownloadMgr.SetUp();
        subModuleMgr = new SubModuleMgr();
        subModuleMgr.RegistSubSystem(NotifySystem.Instance);
        subModuleMgr.RegistSubSystem(FileVersionMgr.Instance);
        subModuleMgr.InitSubSystems();
        subModuleMgr.StartSubSystems();

	}
	
	// Update is called once per frame
	void Update () {
	    
	}

    void showNotify(string text)
    {
        Debugger.Log("showNotify");
        Debugger.Log(text);
    }


    static GameObject _singleInstance;
    public static GameObject FindSingInstance()
    {
        if (_singleInstance)
        {
            return _singleInstance;
        }
        string SingleInstance = "__SingleInstance";
        GameObject obj = GameObject.Find(SingleInstance);
        if (null == obj)
        {
            obj = new GameObject();
            obj.name = SingleInstance;
        }
        return obj;
    }
}
